package andanyoung.seata.mall.controller;

import andanyoung.seata.mall.service.MallService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author andyoung
 */
@RestController
public class MallController {
    @Resource
    private MallService mallService;

    @GetMapping("/sale")
    public String sale(Integer orderId,Integer memberId,Integer goodsId,Integer points,Integer quantity){
        String sale="";
        try{
            sale = mallService.sale(orderId, memberId, goodsId, points, quantity);
        }catch (Exception e){
            System.out.println(e.getMessage());
            e.printStackTrace();
            sale = e.getMessage();
        }
        return sale;
    }
}
